///////////////////////////////////////////////////////////
//  NewItemCommand.cpp
//  Implementation of the Class NewItemCommand
//  Created on:      21-Sep-2013 12:09:39 PM
//  Original author: Jakkaphan Aiemcharoenjit
///////////////////////////////////////////////////////////

#include "NewItemCommand.h"
#include "CurrentCommand.h"

using namespace UI;
using namespace UI::CMD;

NewItemCommand::NewItemCommand(CCreateItemView* createItem, CCreateTemplateView* createTemplate)
{
  this->m_type = ICommand::NEWITEM_CMD;
  this->m_createItemView = createItem;
  this->m_createTemplateView = createTemplate;
}


NewItemCommand::~NewItemCommand()
{

}


void NewItemCommand::Execute()
{
  IObject* data = this->m_createTemplateView->GetCurrentData();
  if(data)
  {
    this->m_createItemView->SetCurListBox(1);
  }
  else
  {
    this->m_createItemView->SetCurListBox(0);
  }
  this->m_createItemView->SetTitleView("Add item");
  this->m_createItemView->ItemTypeEnable(true);
  // Set current command
  CurrentCommand::GetInstance()->SetCurrentCommand(this->m_type);
}


ICommand::CommandType NewItemCommand::GetType()
{
	return this->m_type;
}